package com.rose.doorto.footbathdoor.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rose.doorto.footbathdoor.mapper.ProjectMapper;
import com.rose.doorto.footbathdoor.pojo.Project;
import com.rose.doorto.footbathdoor.service.IProjectService;
import com.rose.doorto.footbathdoor.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * @Author 李庆超
 * @email 1481791489@qq.com
 * @Package：com.rose.doorto.footbathdoor.service.impl
 * @Project：door-to-door
 * @name：IProjectServiceImpl
 * @date 2024/07/10 2024/7/10:10:47:
 */
@Service
public class IProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements IProjectService {

    @Autowired
    private ProjectMapper projectMapper;

    /**
     * 查看项目详情
     * @param id
     * @return
     */
    @Override
    public Result getProjectById(int id) {
        Project project = projectMapper.getProjectById(id);
        if (project!=null){
            return Result.success(project,200,"操作成功");
        }else {
            return Result.error(500,"操作失败");
        }
    }

    /**
     * 获取当前技师的服务项目列表
     * @param tid
     * @return
     */
    @Override
    public List<Project> getProjectListById(Integer tid) {
        return projectMapper.getProjectListById(tid);

    }
}
